package com.coda.config;

import com.coda.Properties.AliOssProperties;
import com.coda.utils.OssUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class AliyunOssConfiguration {

    @Bean
    public OssUtils ossUtils(AliOssProperties aliOssProperties){
        log.info("创建阿里云文件上传对象");
        OssUtils ossUtils = new OssUtils(
                aliOssProperties.getEndpoint(),
                aliOssProperties.getAccessKeyId(),
                aliOssProperties.getAccessKeySecret(),
                aliOssProperties.getBucketName()
        );
        return ossUtils;
    }
}
